<?php
	$grados = array(
		'1' => 'IV',
		'2' => 'IV+',
		'3' => 'V',
		'4' => 'V+',
		'5' => '6a',
		'6' => '6a+',
		'7' => '6b',
		'8' => '6b+',
		'9' => '6c',
		'10' => '6c+',
		'11' => '7a',
		'12' => '7a+',
		'13' => '7b',
		'14' => '7b+',
		'15' => '7c',
		'16' => '7c+',
		'17' => '8a',
		'18' => '8a+',
		'19' => '8b',
		'20' => '8b+',
		'21' => '8c',
		'22' => '8c+',
		'23' => '9a',
		'24' => '9a+',
		'25' => '9b',
		'26' => '9b+'
	);
    //Si recibimos un sector_guid ya no necesitamos pedirlo
    $sector_guid = get_input('sector_guid');
    
    if (!$sector_guid) {
	   	$params = array(
	    	'types' => 'object',
	    	'subtypes' => 'sector'
	    ); 
	    $entities =elgg_get_entities($params);    
	    $sectores = array();
	    foreach($entities as $entity){
	    	$sectores[$entity->guid]= $entity->title;
	    	//$escuelasValues[$entity->guid]= $entity->guid;
	    } 
	    echo '<div style="margin:15px 15px 15px 0px;">';
	    echo '<label>Sectores: </label>';
	    echo elgg_view('input/dropdown',array('name' => 'sector_guid', 'options_values' => $sectores));
	    echo '</div>';
	 
    }else {
    	echo elgg_view('input/hidden',array('name' => 'sector_guid', 'value' => $sector_guid));
    	$sector = get_entity($sector_guid);
    	echo '<h2>en ' . $sector->title . '</h2>';
    }


?>

<div>
    <label><?php echo Nombre ?></label><br />
    <?php echo elgg_view('input/text',array('name' => 'nombre')); ?>
</div>

<div style="margin:0px 15px 15px 0px;">
    <label><?php echo 'Grado: '?></label>
    <?php echo elgg_view('input/dropdown',array('name' => 'grado', 'options' => $grados)); ?>
</div>

<div>
    <label><?php echo Descripcion?></label><br />
    <?php echo elgg_view('input/longtext',array('name' => 'descripcion')); ?>
</div>

<div>
    <label><?php echo Acceso?></label><br />
    <?php echo elgg_view('input/longtext',array('name' => 'acceso')); ?>
</div>

<div>
    <?php echo elgg_view('input/submit', array('value' => 'Guardar')); ?>
</div>